package com.bdqn.mapper;

import com.bdqn.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface UserMapper {
    @Select("select * from SYS_USER where user_name=#{username} and password=#{password} and status=0")
    User selectUser(@Param("username") String username,@Param("password") String password);

    List<User> selectAll(String name);

    @Insert("insert into SYS_USER values(NULL,#{username},#{password},#{status},#{photoPath})")
    int add(User user);

    int addRoles(@Param("uid") Integer uid,@Param("rids")  List<Integer> rids);

    @Update("update SYS_USER set status=#{status} where id=#{id}")
    int updateStatus(@Param("id") int id,@Param("status") int status);

    @Select("select * from SYS_USER where user_id=#{uid}")
    User selectById(int uid);

    @Delete("delete from SYS_ROLE_user where user_id=#{uid}")
    void deleteRole(Integer uid);
//    查询所有医生
    @Select("select * from SYS_USER")
    List<User> getUser();
    //    查询所有医生
    @Select("select * from SYS_USER where user_id=#{userId}")
    User getUserDANGE(int userId);//查询单个医生
}
